/**
 * Copyright &copy; 2012-2016 <a href="https://github.com/thinkgem/jeesite">JeeSite</a> All rights reserved.
 */
package com.server.modules.sys.service.member;

import com.server.common.persistence.Page;
import com.server.common.service.CrudService;
import com.server.modules.sys.dao.member.MemberDao;
import com.server.modules.sys.entity.loan.Loan;
import com.server.modules.sys.entity.member.Member;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * 普通用户信息Service
 * @author 王磊
 * @version 2016-09-22
 */
@Service
@Transactional(readOnly = true)
public class MemberService extends CrudService<MemberDao, Member> {

	public Member get(String id) {
		return super.get(id);
	}
	
	public Member getByHxUsername(String hxUsername) {
		return dao.getByHxUsername(hxUsername);
	}
	
	public List<Member> findList(Member member) {
		return super.findList(member);
	}
	
	public Page<Member> findPage(Page<Member> page, Member member) {
		return super.findPage(page, member);
	}

	public Page<Member> telList(Page<Member> page,Member member) {
			member.setPage(page);
			List<Member> members = dao.telList(member);
        page.setList(members);
        return page;
	}

	public Page<Member> memberloan(Page<Member> page,Member member) {
		member.setPage(page);
		List<Member> members = dao.memberloan(member);
		page.setList(members);
		return page;
	}

	public Page<Loan> membermate(Page<Loan> page, Member member) {
//		loan.setPage(page);
		List<Loan> loans = dao.membermate(member);
		page.setList(loans);
		return page;
	}

	
	@Transactional(readOnly = false)
	public void save(Member member) {
		if(member.getUnionId()!=null&&"".equals(member.getUnionId().trim())){
			member.setUnionId(null);
		}
		super.save(member);
	}
	
	@Transactional(readOnly = false)
	public void delete(Member member) {
		super.delete(member);
	}


	public List<Member> supplement() {
		return dao.supplement();
		}

	public List<Member> newmember() {
		return dao.newmember();
	}
	public List<Member> birthdaysend() {
		return dao.birthdaysend();
	}

	public List<Member> paysuccess(){ return dao.paysuccess(); }
}